<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui"
	xmlns:ui="http://java.sun.com/jsf/facelets">

<h:head>
	<link rel="stylesheet" type="text/css" href="../../css/style.css"
		media="screen" />
	<meta http-equiv="refresh"
		content="#{session.maxInactiveInterval};url=chart-region.xhtml?faces-redirect=true" />

</h:head>

<h:body style="margin:0px;">
	<div class="space"></div>
	<h:form id="form-dialog">
		<p:dialog id="modalDialog" visible="false" widgetVar="dialogModal"
			modal="true" closable="false" draggable="false" resizable="false">
			<p:ajaxStatus onstart="dialogModal.show()"
				oncomplete="dialogModal.hide()" />
			<p:graphicImage value="../../images/loading.gif" />
		</p:dialog>

	</h:form>
	<ui:include src="../common/menu.xhtml" />
	<p:layout fullPage="true">
		<p:ajax event="resize" update=":form-chart:chart-panel" />
		<p:layoutUnit position="north" styleClass="layoutUnit-north">

			<h:form id="form-filter">
				<p:growl id="messages" showDetail="true" autoUpdate="true" />
				<h:panelGroup>
					<div class="report-filter">
						<h:panelGrid columns="5" id="report">
							<h:outputText value="da" styleClass="white" />
							<p:calendar id="dateStart" effect="slideDown" size="12"
								navigator="true" lang="it" value="#{reportBean.dataS}"
								pattern="dd/MM/yyyy" mindate="01/09/2010"
								maxdate="#{reportBean.oggi}">
								<p:ajax event="dateSelect" listener="#{reportBean.changeDataS}"
									update="buttonFilterData" />
								<f:convertDateTime pattern="dd/MM/yyyy" />
							</p:calendar>
							<h:outputText value="a" styleClass="white" />
							<p:calendar id="dateEnd" effect="slideDown" size="12"
								navigator="true" lang="it" value="#{reportBean.dataE}"
								pattern="dd/MM/yyyy" mindate="01/09/2010"
								maxdate="#{reportBean.oggi}">
								<p:ajax event="dateSelect" listener="#{reportBean.changeDataE}"
									update="buttonFilterData" />
								<f:convertDateTime pattern="dd/MM/yyyy" />
							</p:calendar>
							<p:commandButton id="buttonFilterData" value="OK"
								action="#{regionChartBean.refreshChartAction('pieRegionChart')}"
								disabled="#{reportBean.errorDate}" onclick="dialogModal.show();" />

						</h:panelGrid>
					</div>
				</h:panelGroup>
			</h:form>
		</p:layoutUnit>
		<p:layoutUnit position="center" styleClass="layoutUnit-center">

			<h:form id="form-chart">
				<h:panelGrid columns="2" id="chart-panel"
					styleClass="region-detail-panel">
					<p:pieChart id="chart"
						value="#{regionChartBean.getChartModel('pieRegionChart')}"
						legendPosition="w" title="Grafico Regioni - Bet"
						styleClass="chart-region">
						<p:ajax event="itemSelect"
							listener="#{regionChartBean.pieRegionChartItemSelect}"
							update="region-detail,form-chart" />
					</p:pieChart>


					<p:lineChart id="region-detail"
						rendered="#{regionChartBean.selectRegion}"
						value="#{regionChartBean.getChartModel('pieRegionSelectedChart')}"
						legendPosition="ne" fill="false" xaxisLabel="Data"
						yaxisLabel="Dati" title="Grafico Dettagli Regione"
						minY="#{regionChartBean.minValue}"
						maxY="#{regionChartBean.maxValue}"
						styleClass="chart-region-datail">
					</p:lineChart>
				</h:panelGrid>
			</h:form>
		</p:layoutUnit>

	</p:layout>
</h:body>
</html>